﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; 

namespace MS_UI
{
    public partial class FrmView : Form    
    {
        public FrmView()
        { 
            InitializeComponent();
        }

        private void lqb1_DoubleClick(object sender, EventArgs e)
        {
            string DeviceName = string.Empty;
            string StartAddress = string.Empty;
            string StopAddress = string.Empty;
            string DeviceStartName = string.Empty;
            string DeviceStopName = string.Empty;

            // 设备判断
            //if (sender is LQB)
            //{
            //    LQB item = (LQB)sender;
            //    DeviceName = item.DeviceName;         
            //    DeviceStartName = item.DeviceStartName;
            //    DeviceStopName = item.DeviceStopName;
            //}
            //else if (sender is Tap)
            //{
            //    Tap item = (Tap)sender;
            //    DeviceName = item.DeviceName;
            //    DeviceStartName = item.DeviceStartName;
            //    DeviceStopName = item.DeviceStopName;
            //}
            // 采集参数
            if (CommonMethod.CurrentVarAddress.ContainsKey(DeviceStartName))
            {
                StartAddress = CommonMethod.CurrentVarAddress[DeviceStartName] ;
            }
            if (CommonMethod.CurrentVarAddress.ContainsKey(DeviceStopName))
            {
                StopAddress = CommonMethod.CurrentVarAddress[DeviceStopName];
            }

            // 调用窗体
            Frm_DeviceControl objFrm = new Frm_DeviceControl(DeviceName,StartAddress,StopAddress);
            objFrm.ShowDialog();
        }
    }
}
 